removemenuitem

Removes an action item from the given menu in the Compose user interface. removemenuitem is only available in the Compose GUI.

Syntax

removemenuitem(rbname, name, removeparentifempty)

removemenuitem(uiAction, removeparentifempty)

Inputs

rbname
The name of the ribbon menu.
Type: string
name
The name of the action item.
Type: string
removeparentifempty
An optional argument. If true, removes the parent if it's the only item. Default = false.
Type: Boolean
uiAction
The handle to the action.
Type: class

Examples

Remove an action item from the given menu:
pm=addribbonmenu('Test'); % create a 'Test' ribbon page as menu
ab = addmenuitem(pm,'Show Test Label','Show Test','HandleTest','','');
ac = addmenuitem('Test','Show Test Label 1', 'Show Test 1','HandleTest_1','','');

% create popup menus
pp=addpopupmenu('Test', 'Test 2'); % create a sub popup menu "Test 2" under ribbon page 'Test'
pp1=addpopupmenu(pp, 'Test 3'); % create a popup menu 'Test 3' under ribbon page 'Test'
% create a menu actions with label 'Show Test Label 2' and name 'Show Test 2' under sub popup menu 'Test 2'
ad = addmenuitem(pp,'Show Test Label 2','Show Test 2','HandleTest_2','A test 2 menu action','clicked Test 2');
% create a menu actions with label 'Show Test Label 3' and name 'Show Test 3' under sub popup menu 'Test 3'
ae = addmenuitem(pp1,'Show Test Label 3','Show Test 3','HandleTest_3','A test 3 menu action','clicked Test 3');

function HandleTest()
	disp('Show Test is handled');
end

function HandleTest_1()
	disp('Show Test 1 is handled');
end

function HandleTest_2()
	disp('Show Test 2 is handled');
end

function HandleTest_3()
	disp('Show Test 3 is handled');
end
			
removemenuitem('Test','Show Test Label 1'); % remove action by specifying action label
removemenuitem(ad); % remove by handle